#include <PopupDefaultLogger.hpp>
#include <stdarg.h>
#include <stdio.h>

using namespace Popup;

struct MyPopupLogger : public PopupLoggerUI
{
  void appendLog(enum PopupLogLevel p_level,
		 const char *p_format, ...);
};

void MyPopupLogger::appendLog(enum PopupLogLevel p_level,
			      const char *p_format, ...)
{
  va_list _args;
  char log[1024];
  va_start(_args, p_format);
  vsprintf(log, p_format, _args);
  printf("The trace level is %d : Message=[%s]\n", p_level, log);
  va_end(_args);
}

int main(int argc, char *argv[])
{
  PopupDefaultLogger logger;
  logger.appendLog(POPUP_LOG_TRACE,    "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  logger.appendLog(POPUP_LOG_INFO,     "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  logger.appendLog(POPUP_LOG_WARNING,  "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  logger.appendLog(POPUP_LOG_ERROR,    "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  logger.appendLog(POPUP_LOG_CRITICAL, "Function:%s, Line:%d ", __FUNCTION__, __LINE__);

  MyPopupLogger mylogger;
  mylogger.appendLog(POPUP_LOG_TRACE,    "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  mylogger.appendLog(POPUP_LOG_INFO,     "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  mylogger.appendLog(POPUP_LOG_WARNING,  "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  mylogger.appendLog(POPUP_LOG_ERROR,    "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  mylogger.appendLog(POPUP_LOG_CRITICAL, "Function:%s, Line:%d ", __FUNCTION__, __LINE__);
  return 0;
}
